package com.lancoo.lancooimageloader.xutils3;

import android.graphics.drawable.Drawable;

import com.lancoo.lancooimageloader.LancooImageCallback;

import org.xutils.common.Callback;

/**
 * Author: Andecy
 * Time: 2017/5/22
 * Email: andecy@foxmail.com
 * Description: TODO
 */

public class xUtilsImageCallback implements Callback.CommonCallback<Drawable> {
    private LancooImageCallback mImageCallback;

    public xUtilsImageCallback(LancooImageCallback imageCallback) {
        mImageCallback = imageCallback;
    }

    @Override
    public void onSuccess(Drawable drawable) {
        mImageCallback.onSuccess(drawable);
    }

    @Override
    public void onError(Throwable throwable, boolean b) {
        mImageCallback.onError(throwable, b);
    }

    @Override
    public void onCancelled(CancelledException e) {
        mImageCallback.onCancelled(new LancooImageCallback.CancelledException(e.getMessage()));
    }

    @Override
    public void onFinished() {
        mImageCallback.onFinished();
    }
}
